import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../../../utils/utils_logger.dart';
import '../../../../widgets/detail_item_widget/detail_item_view.dart';
import '../../../../widgets/globel_widget.dart';
import '../../../../widgets/spirit/spirit_view.dart';

class inPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: [
          const Center(child: Text('Group1')),
          IconButton(
              icon: const Icon(Icons.add),
              tooltip: "添加分组",
              onPressed: () {
                print("Search Pressed");
              }),
        ],
      ),
      body: Container(
        child: Column(
          children: [
            spaceHeight(),
            buildSpiritComponent(),
            buildLine(),
            DetailItemComponent(
                leftLabel: "故障时间",
                leftText: "2023/06/28 12:23",
                rightLabel: "故障代码",
                rightText: "M23,M34"),
            buildLine(),
            DetailItemComponent(
                leftLabel: "受理时间",
                leftText: "2023/06/28 12:23",
                rightLabel: "工程人员",
                rightText: "M23,M34"),
            buildLine(),
            DetailItemComponent(
                leftLabel: "工程人员确认时间",
                leftText: "2023/06/28 12:23",
                rightLabel: "工程人员确认",
                rightText: "M23,M34"),
            buildLine(),
            DetailItemComponent(
                leftLabel: "恢复时间",
                leftText: "2023/06/28 12:23",
                rightLabel: "人员确认",
                rightText: "M23,M34"),
            buildLine(),
            buildEngineerOpt(),
          ],
        ),
      ),
    );
  }

  buildSpiritComponent() {
    return SpiritComponent(
      onTap: () {
        logd('onTap');
      },
      onLongPress: () {
        logd('onLongPress');
      },
      lLeftText: 'MS-L1',
      lRightText: '18/F',
      rLeftText: 'AL',
      rCenterText: 'PW',
      rLeftColor: Colors.red,
      rCenterColor: Colors.orange,
    );
  }

  buildLine() {
    return Container(
      child: Column(
        children: [
          spaceHeight(),
          Container(
            color: Colors.grey,
            height: 1,
          ),
          spaceHeight(),
        ],
      ),
    );
  }

  ///构建工程人员操作
  buildEngineerOpt() {
    final ButtonStyle style =
    ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20));

    return Container(
        color: const Color(0xFFBDBDBD),
        padding: const EdgeInsets.all(10),
        child: Row(children: [
          const Text("工程人操作", style: TextStyle(fontSize: 16)),
          Flexible(
            child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  ElevatedButton(
                    style: ButtonStyle(
                        foregroundColor:
                        MaterialStateProperty.all(Colors.amber),
                        backgroundColor:
                        MaterialStateProperty.all(const Color(0xFF757575)),
                        textStyle: MaterialStateProperty.all(
                            const TextStyle(fontSize: 16)),
                        overlayColor:
                        MaterialStateProperty.all(Colors.blueGrey)),
                    onPressed: () {
                      print("Search Pressed");
                    },
                    child: const Text('受理确认'), //选中的颜色字体颜色
                  ),
                  ElevatedButton(
                    style: ButtonStyle(
                        foregroundColor:
                        MaterialStateProperty.all(Colors.green),
                        backgroundColor:
                        MaterialStateProperty.all(const Color(0xFFD6D6D6)),
                        textStyle: MaterialStateProperty.all(
                            const TextStyle(fontSize: 16)),
                        overlayColor:
                        MaterialStateProperty.all(Colors.blueGrey)),
                    onPressed: () {
                      print("Search Pressed");
                    },
                    child: const Text('恢复确认'), //选中的颜色字体颜色
                  )
                ]),
          )
        ]));
  }
}
